package com.mo.axion.handler.action;

import com.mo.axion.common.domain.TaskInfo;
import com.mo.axion.common.pipeline.BusinessProcess;
import com.mo.axion.common.pipeline.ProcessContext;
import com.mo.axion.handler.handler.HandlerHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * @author Mo
 * @createTime 2024/2/25 14:48
 * @description 调用渠道方下发消息
 */
@Slf4j
@Service
public class SendMessageAction implements BusinessProcess<TaskInfo> {

    private static final long SECONDS_OF_A_DAY = 86400L;

    @Autowired
    private HandlerHolder handlerHolder;

    /**
     * 真正处理逻辑
     *
     * @param context
     */
    @Override
    public void process(ProcessContext<TaskInfo> context) {
        TaskInfo taskInfo = context.getProcessModel();
        handlerHolder.route(taskInfo.getSendChannel()).doHandler(taskInfo);
    }
}
